﻿@model BugChang.DES.Web.Mvc.Views.Shared.Components.SideBarNav.SideBarNavViewModel



<aside class="main-sidebar">
    <!-- sidebar: style can be found in sidebar.less -->
    <section class="sidebar">
        <!-- Sidebar user panel -->
        <div class="user-panel">
            <div class="pull-left image">
                <img src="~/images/user2-160x160.jpg" class="img-circle" alt="User Image">
            </div>
            <div class="pull-left info">
                <p>@(User.FindFirst("DisplayName").Value)</p>
                <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
            </div>
        </div>
        <!-- search form -->
        <form action="#" method="get" class="sidebar-form">
            <div class="input-group">
                <input type="text" name="q" class="form-control" placeholder="Search...">
                <span class="input-group-btn">
                    <button type="submit" name="search" id="search-btn" class="btn btn-flat">
                        <i class="fa fa-search"></i>
                    </button>
                </span>
            </div>
        </form>
        <!-- /.search form -->
        <!-- sidebar menu: : style can be found in sidebar.less -->
        <ul class="sidebar-menu" data-widget="tree">
            @*不影响排版，最多支持三级菜单*@
            @foreach (var menu in Model.Menus.Where(a => a.ParentId == null).OrderBy(a => a.Id))
            {
                if (menu.Items.Count > 0)
                {
                    <li class="treeview @(Model.ActiveMenuName.Contains(menu.Name)?"active":"")">
                        <a href="#">
                            <i class="fa fa-book"></i> <span>@menu.Name</span>
                            <span class="pull-right-container">
                                <i class="fa fa-angle-left pull-right"></i>
                            </span>
                        </a>
                        <ul class="treeview-menu">
                            @foreach (var item in menu.Items)
                            {
                                if (item.Items.Count > 0)
                                {
                                    <li class="treeview @(Model.ActiveMenuName.Contains(item.Name)?"active":"")">
                                        <a href="#">
                                            <i class="fa fa-book"></i> <span>@item.Name</span>
                                            <span class="pull-right-container">
                                                <i class="fa fa-angle-left pull-right"></i>
                                            </span>
                                        </a>
                                        <ul class="treeview-menu">
                                            @foreach (var subItem in item.Items)
                                            {
                                                <li class="@(Model.ActiveMenuName.Contains(subItem.Name) ? "active" : "")"><a href="@subItem.Url"><i class="fa fa-bookmark"></i> @subItem.Name</a></li>
                                            }
                                        </ul>

                                    </li>
                                }
                                else
                                {
                                    <li class="@(Model.ActiveMenuName.Contains(item.Name) ? "active" : "")"><a href="@item.Url"><i class="fa fa-bookmark"></i> @item.Name</a></li>
                                }
                            }
                        </ul>

                    </li>
                }
                else
                {
                    <li class="@(Model.ActiveMenuName.Contains(menu.Name) ? "active" : ""))"><a href="@menu.Url"><i class="fa fa-bookmark"></i> @menu.Name</a></li>
                }
            }
        </ul>
    </section>
    <!-- /.sidebar -->
</aside>